package com.demo.controller;


import com.demo.model.Order;
import com.demo.model.Searches;
import com.demo.service.Demo1Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("v1/demo")
public class Demo1Controller {

  @Autowired
  private Demo1Service demo1Service;


  @PostMapping("demo1")
  public String demo1() {

    String s = demo1Service.demo1();


    System.out.println(s);

    return s;
  }

  @PostMapping("demo2")
  public void demo2(@RequestParam String id) {

    demo1Service.demo2(id);

  }

  @PostMapping("demo3")
  public PageInfo<Order> demo3(@RequestBody Searches searches) {

    PageInfo<Order> orders = demo1Service.demo3(searches);

    return orders;

  }

}
